Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal saltedData() As Byte, _ ByVal szSalt As Salt.Size _ ) |
C# | |
---|---|
public SaltedData( byte[] saltedData, Salt.Size szSalt ) |
Parameters
- saltedData
- szSalt
Library/Library.Test/TestSalt.cs
C# | Copy Code |
---|---|
Salt s = new Salt(Salt.Size.b64); byte[] testData = new byte[8]; new Random().NextBytes(testData); byte[] tmp; using (SaltedData sd = new SaltedData(s, testData)) { Assert.AreEqual(16, sd.Length); Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); tmp = sd.ToArray(); Assert.AreEqual(16, tmp.Length); Assert.AreEqual(tmp, IOStream.ReadAllBytes(sd.ToStream())); } using (SaltedData sd = new SaltedData(s, new MemoryStream(testData))) { Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); Assert.AreEqual(tmp, sd.ToArray()); } using (SaltedData sd = new SaltedData(tmp, Salt.Size.b64)) { Assert.AreEqual(s, sd.Salt); Assert.AreEqual(testData, sd.GetDataBytes()); Assert.AreEqual(tmp, sd.ToArray()); } |
VB.NET | Copy Code |
---|---|
Dim s As New Salt(Salt.Size.b64) Dim testData As Byte() = New Byte(8) {} New Random().NextBytes(testData) Dim tmp As Byte() Using sd As New SaltedData(s, testData) Assert.AreEqual(16, sd.Length) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) tmp = sd.ToArray() Assert.AreEqual(16, tmp.Length) Assert.AreEqual(tmp, IOStream.ReadAllBytes(sd.ToStream())) End Using Using sd As New SaltedData(s, New MemoryStream(testData)) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) Assert.AreEqual(tmp, sd.ToArray()) End Using Using sd As New SaltedData(tmp, Salt.Size.b64) Assert.AreEqual(s, sd.Salt) Assert.AreEqual(testData, sd.GetDataBytes()) Assert.AreEqual(tmp, sd.ToArray()) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
SaltedData ClassSaltedData Members
Overload List